import { CoolController, BaseController, TagTypes, CoolTag } from '@cool-midway/core';
import { UserDataEntity } from '../../entity/data';
import { Body, Get, Inject, Query, Post } from '@midwayjs/core';
import { UserSectsService } from '../../service/sect'
/**
 * 用户信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: UserDataEntity,
  pageQueryOp: {
    // fieldEq: ['status', 'gender', 'loginType'],
    keyWordLikeFields: ['nickName'],
  },
})
export class AdminUserInfoController extends BaseController {
  @Inject()
  UserSectsService: UserSectsService;

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/getChatRace', { summary: '获取种族统计数据' })
  async getChatRace() {
    return this.ok(await this.UserSectsService.getChatRace());
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/getChatSect', { summary: '获取门派统计数据' })
  async getChatSect() {
    return this.ok(await this.UserSectsService.getChatSect());
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Get('/getGoodsItems', { summary: '获取背包物品' })
  async getGoodsItems(@Query('uid') uid: number,) {
    return this.ok(await this.UserSectsService.getGoodsItems(uid));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/setGoodsItems', { summary: '获取背包物品' })
  async setGoodsItems(
    @Body('data') data: any,
  ) {
    return this.ok(await this.UserSectsService.setGoodsItems(data));
  }
}
